<?php /**
 * Template Name: Blog Page
 *  */
?>
<?php get_header();?>
<div id="wrapper" class="container_12">
	<?php
if (is_page() ) {
  $args=array(    'paged' => (get_query_var('paged')) ? get_query_var('paged') : 1 );
  $temp = $wp_query;   
  $wp_query = null;
  $wp_query = new WP_Query($args);
	?>
	<div class="grid_8">
		<?php  if( have_posts() ) : 	while ($wp_query->have_posts()) : $wp_query->the_post();
		?>

		<div <?php post_class() ?> >
			<h2 class="title"><a href="<?php the_permalink();?>" title="<?php echo esc_attr(sprintf(__('Permanent Link to %s', 'mt-white'), the_title_attribute('echo=0')));?>" rel="bookmark"><?php the_title();?></a></h2>
			<div class="entry">
				<?php
				if((function_exists('add_theme_support')) && ( has_post_thumbnail())) {
					the_post_thumbnail('single_post');
				}
				?>
				<?php the_content(__('(more...)', 'mt-white'));?>
				<div class="clear"></div>
			</div>
			<?php if(is_search()) :
			?>
			<ul class="postmeta">
				<li>
					<?php white_posted_on();?>
				</li>
				<li>
					<?php comments_popup_link(__('Leave a comment', 'mt-white'), __('1 Comment', 'mt-white'), __('% Comments', 'mt-white'));?>,
				</li>
				<li>
					<?php _e('Author', 'mt-white');?>:
					<?php the_author_posts_link();?>
				</li>
			</ul>
			<?php else :?>
			<ul class="postmeta">
				<li>
					<?php white_posted_on();?>
				</li>
				<li>
					<?php comments_popup_link(__('Leave a comment', 'mt-white'), __('1 Comment', 'mt-white'), __('% Comments', 'mt-white'));?>,
				</li>
				<li>
					<?php _e('Author', 'mt-white');?>:
					<?php the_author_posts_link();?>
				</li>
				<li>
					<?php _e('Categories', 'mt-white');?>:
					<?php the_category(', ')
					?>
				</li>
				<?php the_tags('<li><br />' . __('Tags: ', 'mt-white'), ', ', '</li>');?>
			</ul>
			<?php endif;?>
		</div>
		<?php comments_template('', true);?>
		<?php endwhile;?>
		<?php  white_pagination();?>
		<?php   else :?>
		<div class="title">
			<h1><?php _e('Not Found', 'mt-white');?></h1>
			<p>
				<?php _e('Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'mt-white');?>
			</p>
		</div>
		<?php endif; $wp_query = $temp; }?>
	</div>
	<?php get_sidebar();?>
	<div class="clear"></div>
</div>
<?php get_footer();?>

